﻿
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;

namespace Granite.DataAnnotations
{
    /// <summary>
    /// Collection of validation results
    /// </summary>
    public class ValidationResultCollection : Collection<ValidationResult>
    {
        /// <summary>
        /// Adds a new validation result to the collection
        /// </summary>
        /// <param name="errorMessage"></param>
        /// <param name="memberNames"></param>
        /// <returns></returns>
        public ValidationResult Add(string errorMessage, params string[] memberNames)
        {
            var result = new ValidationResult(errorMessage, memberNames);
            Add(result);
            return result;
        }
    }
}

